<?php  
$cu_group = $this->usergroup_manager->get($this->current_user()->usergroup_id);  
$ci=&get_instance();  
require_once(APPPATH."views/".$ci->template."/admin_helper.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>巨人软件研发公司 - 后台管理中心 - Powered by Jurensoft</title>
	<base href="<?=_V('default/admin/',$with_host=true)?>"/>
	<script>var jrcms_au=null;</script> 
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script src='../../scripts/jquery-1.5.1.js'></script> 
	<script src='../../scripts/kindeditor/kindeditor.js' charset="utf-8" ></script>
	<script src='../../scripts/kindeditor/lang/zh_CN.js' charset="utf-8" ></script>
	<link href="../../scripts/jquery_plugins/jquery_ui/jquery-ui-1.8.11.custom.css" rel="stylesheet" type="text/css"/>
	<script src='../../scripts/jquery_plugins/jquery_ui/jquery-ui-1.8.11.custom.min.js' charset="utf-8" ></script>
	<link href="../../scripts/jquery_plugins/jquery_ui/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css"/>
	<script src='../../scripts/jquery_plugins/jquery_ui/jquery-ui-timepicker-addon.js' charset="utf-8" ></script>
	<script src='../../scripts/jquery_plugins/idTabs/jquery.idTabs.js' charset="utf-8" ></script>
	<script src="../../scripts/jr_common.js" charset="utf-8"></script>
	
	<script src="../../scripts/jquery_plugins/ztree/jquery.ztree.core-3.0.js" type="text/javascript"></script>  
	<link href="../../scripts/jquery_plugins/ztree/zTreeStyle.css" rel="stylesheet" type="text/css"/>

	
	<script> 
	window.UEDITOR_HOME_URL = "<?php echo _V("scripts/ueditor/")?>";
	</script> 
    <script type="text/javascript" charset="utf-8" src="../../scripts/ueditor/editor_config.js"></script>
	<script type="text/javascript" charset="utf-8" src="../../scripts/ueditor/editor_all.js"></script>
    <link rel="stylesheet" type="text/css" href="../../scripts/ueditor/themes/default/ueditor.css"/>
	<link rel="stylesheet" type="text/css" href="../../scripts/ueditor/themes/default/iframe.css"/>
	
	<link href="global.css" rel="stylesheet" type="text/css"/>
	
	<script src="../../scripts/tooltip.js" type="text/javascript"></script> 
	<script>
	$(document).ready(function(){
        /*
		$('.left_menu dl dd:gt(0)').mouseover(function(){
			$('.left_menu dl dd:gt(0)').attr("class","normal") ;
            $(this).attr("class","selected");
		});*/
  
		$('.datatable tbody tr:even').css('background-color','whiteSmoke');
		$('.formtable tbody tr:even').css('background-color','whiteSmoke'); 

	});
	</script>  
	
	
	
	<!--[if IE 6]>
	<script type="text/javascript" src="../../scripts/DD_belatedPNG.js" ></script>
	<script type="text/javascript">
	DD_belatedPNG.fix('.picpng');
	</script>
	<![endif]-->  
	
</head>

<body style="background:url(images/bg1.jpg) center top;width:1002px;margin: 0px auto">
	<div class="box" >
		<div class="header picpng" style="background:url(images/header_bg.png) no-repeat;
			height:72px;padding: 10px 10px 0px;">
			<a  href="http://cms.jurensoft.cn/" target="_blank">
				<img style="margin:10px 15px" src="images/logo.png"/>
			</a>
			<span>

			</span>
			<div class="top_right" >
				<ul style="list-style:none;margin-top:0px"> 
					<?php 
					 $user=$this->current_user(); 
					 //print_r($user);exit;
					?>
					<li>
						<span style="">
							您好，
							<a href="<?php echo _U("user/selfinfo?returnurl=".$_SERVER["REQUEST_URI"])?>" title="点击设置">
								<strong><?php echo $user->nickname?>！</strong>
							</a>
							[<a href="<?php echo _U("user/logout")?>">退出</a>]
						</span>
				 	</li>
					<li>
						<a style="" href="http://cms.jurensoft.cn/" target="_blank">官方网站</a> |
						<!-- <a style="" href="http://www.jurensoft.cn/?msg.html" target="_blank">客户留言</a> |  -->
						<a style="" href="http://cms.jurensoft.cn/help/help.doc" >帮助？</a>
					</li>
				</ul>
			</div>
			
			
		</div>
		<div id="navigator" class='picpng'><div class="nav_bg"><div class="nav">
			<ul style="">
				<li class="picpng <?php echo (empty($_GET['tab'])  || $this->input->get('tab')=='system_manager')?'on':'';?>">
					<a href="<?php echo _U("entry/index?tab=system_manager")?>" class='picpng'>系统</a>
				</li>
				<?php if($cu_group->permission("article","index")):?>
				<li class="picpng <?php echo ($this->input->get('tab')=='article_manager')?'on':'';?>">
					<a href="<?php echo _U("article/index?tab=article_manager")?>" class='picpng'>文章</a>
				</li>
				<?php endif;?>
				<?php if($cu_group->permission("page","index")):?>
				<li class="picpng <?php echo ($this->input->get('tab')=='page_manager')?'on':'';?>">
					<a href="<?php echo _U("page/index?tab=page_manager")?>" class='picpng'>单页</a>
				</li>
				<?php endif;?>
				<?php if($cu_group->permission("link","index")):?>
				<li class="picpng <?php echo ($this->input->get('tab')=='link_manager')?'on':'';?>">
					<a href="<?php echo _U("link/index?tab=link_manager")?>" class='picpng'>链接</a>
				</li>
				<?php endif;?>
				
				<!--li class="picpng <?php echo ($this->input->get('tab')=='seoprice_manager')?'on':'';?>">
					<a href="<?php echo _U("seo_price/index?tab=seoprice_manager")?>" class='picpng'>SEO</a>
				</li-->
			</ul>
		</div></div></div>

		<div class="c picpng" style="border:0px solid black;width:1002px;background:url(images/left_bg.png) left bottom no-repeat;">
			<div class="right" style="float:right;width:792px;border:0px solid black;margin:0px;padding:0px">
				<div id="position">
					<div class="position">
						<a href="<?php echo _U("entry/index?tab=system_manager")?>" title="后台首页" style="color:black">首页</a>
						<div class="splitter"></div>
						<a><?php
						$global_positions = lang('global_positions');
						echo $global_positions[$this->router->fetch_class()]; ?>
						</a>
						<div class="splitter"></div>
						<?php $global_actions = lang('global_actions');
						echo $global_actions[$this->router->fetch_method()]; ?>
					</div>
					<div class="quick">
						<a href="<?php echo _P("index.php")?>"  target="_blank">前台首页</a> 
						<a href="<?php echo _U("cache/?returnurl=".urlencode(_CU()))?>" class="on">清除缓存</a>
					</div>
				</div>
				<div class="main  picpng">
					{load block('content')}
				</div>
				
				<div class="right_bottom picpng">
				
				</div>
				
				<div style="clear:both"></div>
			</div>
			<div class="left" style="border:0px solid black;float:left;width:210px;background: url(images/position_bg.gif) right top no-repeat;">
			
				<?php $tab = $this->input->get('tab');?>
				<?php if(empty($tab) || $tab=='system_manager' || $tab=='seoprice_manager' ):?>
				
				<div class="left_menu" style="margin-top:0px;">
					<h5 class="h5_1">菜单管理</h5>
					<dl class="top_h5">
						<dd class="one_top">
							<a><span class="d0">菜单管理</span></a>
						</dd>
						<?php if($cu_group->permission("menu","index")):?>
						<?foreach(menus() as $name=>$menu):?>
						<dd class="<?php echo ($name==$this->input->get('name'))?"selected":"noraml"?>">
							<a href="<?=_U("menu/index?name=$name")?>"><span class="d0">{menu->show_name}</span></a>
						</dd>
						<?endforeach;?> 
						<?php endif;?>
					</dl>
					<h5 class="h5_2">资源管理</h5>
					<dl class="l_5">
						<?php if($cu_group->permission("article_class","index")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="article_class")?"selected":"m4"?>">
							<a href="<?=_U("article_class/index?tab=system_manager")?>"><span class="d4">文章分类</span></a>
						</dd>
						<?php endif;?>
						<?php if($cu_group->permission("page_class","index")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="page_class")?"selected":"m5"?>">
							<a href="<?=_U("page_class/index?tab=system_manager")?>"><span class="d5">单页分类</span></a>
						</dd>
						<?php endif;?>
						<?php if($cu_group->permission("link_class","index")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="link_class")?"selected":"m6"?>">
							<a href="<?=_U("link_class/index?tab=system_manager")?>"><span class="d6">链接分类</span></a>
						</dd>
						<?php endif;?>
						<?php if($cu_group->permission("guest_book","index")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="guest_book")?"selected":"m7"?>">
							<a href="<?=_U("guest_book")?> "><span class="d7">留言板</span></a>
						</dd>
						<?php endif;?>
					</dl>
					<h5 class="h5_2">用户管理</h5>
					<dl class="l_5">
						<?php if($cu_group->permission("user","index")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="user")?"selected":"m4"?> ">
						<a href="<?=_U("user/index?tab=system_manager")?>"><span class="d4">用户管理</span></a>
						</dd>
						<?php endif;?>
						<?php if($cu_group->permission("usergroup","index")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="usergroup")?"selected":"m4"?> ">
							<a href="<?=_U("usergroup/index?tab=system_manager")?>"><span class="d5">用户组管理</span></a>
						</dd>
						<?php endif;?>
					</dl>
					<h5 class="h5_2">网站管理</h5>
					<dl class="l_5">
						<?php if($cu_group->permission("site_info","edit")):?>
						<dd class="<?php echo ($this->uri->segment(1)=="site_info")?"selected":"m4"?> ">
							<a href="<?=_U("site_info/edit?tab=system_manager")?>"><span class="d4">基本信息</span></a>
						</dd>
						<?php endif;?>
						<dd class="<?php echo ($this->uri->segment(1)=="template")?"selected":"m5"?> ">
						<?php if($cu_group->permission("template","index")):?>
							<a href="<?=_U("template/index?tab=system_manager")?>"><span class="d5">模版管理</span></a>
						</dd>
						<?php endif;?>
					</dl>
				</div>
				
				<?php endif;?>
				
				
				
				
				
				<?php if($tab=='article_manager'):?>
				<script>
					$(document).ready(function(){
						// alert("abc") ; 
				
						var article_classs = new Array();
						<?
						if(!empty($_GET['class-id']))
						{
							$ccls = $this->article_class_manager->get($this->input->get('class-id'));
							$ancestors = $ccls->ancestors;
							for($i=0;$i<sizeof($ancestors);$i++)
							{
								$ancestor = $ancestors[$i];
								echo "article_classs[$i]='$ancestor->id';";
							} 
							echo "article_classs[".sizeof($ancestors)."]='$ccls->id';";
						}
						?>
				
						var isExpand = new Array();
						// 构建文章分类列表
						var article_class_setting = {
							async: {
								enable: true,
								url:"<?=_U('article_class/get_list_for_ztree')?>",
								autoParam:["id"],
								treeNodeKey : "id", 
						        treeNodeParentKey : "pid"
							},
							callback: {
								onClick : article_class_onClick,
								onAsyncSuccess: function (event, treeId, treeNode, msg) {
								    //alert(msg);
									var treeObj = $.fn.zTree.getZTreeObj("article_class_tree");
								    for(i=0;i<article_classs.length;i++)
								    {
								    	// alert(article_classs[i]);
								    	var id = article_classs[i];
								    	var node =  treeObj.getNodeByParam("id",id, null);
								    	// alert(id); 
								    	if(node!=null)
								    	{
											if(isExpand[id]!=true)
											{
												treeObj.selectNode(node); 
												treeObj.expandNode(node);
												isExpand[id]=true;
											}
								    	}
								    } 
								}
							},
							edit:{
								enable: true
							},
							view:{
								showIcon:false
							}
						};
				
						function article_class_onClick(event, treeId, treeNode) {
							if(!treeNode.isParent)
							{
								window.open("<?=_U('article/index')."?tab=article_manager&class-id="?>" + treeNode.id,'_self');
							}
							else
							{
								window.open("<?=_U('article/index')."?tab=article_manager&class-id="?>" + treeNode.id + "&descendant=true",'_self');
							}
						} 
				
						$.fn.zTree.init($("#article_class_tree"), article_class_setting );
						// var treeObj = $.fn.zTree.getZTreeObj("article_class_tree");
				
						// treeObj.expandAll(true) ; 
					});
				 </script>
				 <div class="left_menu" style="margin-top:0px;"> 
					<h5 class="h5_2">文章分类</h5>
					<div class="ul_top">文章分类</div>
					<div class="ul_div" >
					<ul id="article_class_tree" class="ztree other1" style="margin-top:-1px;list-style:none;margin-left:20px;font-size:16px;"></ul>
					</div>
				</div>
				<?php endif;?>
				
				
				
				<?php if($tab=='page_manager'):?>
				<div class="left_menu" style="margin-top:0px;">
				
				 <script>
					$(document).ready(function(){
						// alert("abc") ; 
				
						var page_classs = new Array();
						<?
						if(!empty($_GET['class-id']))
						{
							$ccls = $this->page_class_manager->get($this->input->get('class-id'));
							$ancestors = $ccls->ancestors;
							for($i=0;$i<sizeof($ancestors);$i++)
							{
								$ancestor = $ancestors[$i];
								echo "page_classs[$i]='$ancestor->id';";
							} 
							echo "page_classs[".sizeof($ancestors)."]='$ccls->id';";
						}
						?>
				
						var isExpand = new Array();
						// 构建单页分类列表
						var page_class_setting = {
							async: {
								enable: true,
								url:"<?=_U('page_class/get_list_for_ztree')?>",
								autoParam:["id"],
								treeNodeKey : "id", 
						        treeNodeParentKey : "pid"
							},
							callback: {
								onClick : page_class_onClick,
								onAsyncSuccess: function (event, treeId, treeNode, msg) {
								    //alert(msg);
									var treeObj = $.fn.zTree.getZTreeObj("page_class_tree");
								    for(i=0;i<page_classs.length;i++)
								    {
								    	// alert(page_classs[i]);
								    	var id = page_classs[i];
								    	var node =  treeObj.getNodeByParam("id",id, null);
								    	// alert(id); 
								    	if(node!=null)
								    	{
											if(isExpand[id]!=true)
											{
												treeObj.selectNode(node); 
												treeObj.expandNode(node);
												isExpand[id]=true;
											}
								    	}
								    } 
								}
							},
							edit:{
								enable: true
							},
							view:{
								showIcon:false
							}
						};
				
						function page_class_onClick(event, treeId, treeNode) {
							if(!treeNode.isParent)
							{
								window.open("<?=_U('page/index')."?tab=page_manager&class-id="?>" + treeNode.id,'_self');
							}
							else
							{
								window.open("<?=_U('page/index')."?tab=page_manager&class-id="?>" + treeNode.id + "&descendant=true",'_self');
							}
						} 
				
						$.fn.zTree.init($("#page_class_tree"), page_class_setting );
						// var treeObj = $.fn.zTree.getZTreeObj("page_class_tree");
				
						// treeObj.expandAll(true) ; 
					});
				 </script>
					<h5 class="h5_2">单页分类</h5>
					<div class="ul_top">单页分类</div>
					<div class="ul_div" >
						<ul id="page_class_tree" class="ztree other1" style="margin-top:-1px;list-style:none;margin-left:20px;font-size:16px;"></ul>
					</div>
				</div>
				<?php endif;?>
				
				
				
				
				
				<?php if($tab=='link_manager'):?>
				<div class="left_menu" style="margin-top:0px;">
				
				 	<script>
					$(document).ready(function(){
						// alert("abc") ; 
				
						var link_classs = new Array();
						<?
						if(!empty($_GET['class-id']))
						{
							$ccls = $this->link_class_manager->get($this->input->get('class-id'));
							$ancestors = $ccls->ancestors;
							for($i=0;$i<sizeof($ancestors);$i++)
							{
								$ancestor = $ancestors[$i];
								echo "link_classs[$i]='$ancestor->id';";
							} 
							echo "link_classs[".sizeof($ancestors)."]='$ccls->id';";
						}
						?>
				
						var isExpand = new Array();
						// 构建链接分类列表
						var link_class_setting = {
							async: {
								enable: true,
								url:"<?=_U('link_class/get_list_for_ztree')?>",
								autoParam:["id"],
								treeNodeKey : "id", 
						        treeNodeParentKey : "pid"
							},
							callback: {
								onClick : link_class_onClick,
								onAsyncSuccess: function (event, treeId, treeNode, msg) {
								    //alert(msg);
									var treeObj = $.fn.zTree.getZTreeObj("link_class_tree");
								    for(i=0;i<link_classs.length;i++)
								    {
								    	// alert(link_classs[i]);
								    	var id = link_classs[i];
								    	var node =  treeObj.getNodeByParam("id",id, null);
								    	// alert(id); 
								    	if(node!=null)
								    	{
											if(isExpand[id]!=true)
											{
												treeObj.selectNode(node); 
												treeObj.expandNode(node);
												isExpand[id]=true;
											}
								    	}
								    } 
								}
							},
							edit:{
								enable: true
							},
							view:{
								showIcon:false
							}
						};
				
						function link_class_onClick(event, treeId, treeNode) {
							if(!treeNode.isParent)
							{
								window.open("<?=_U('link/index')."?tab=link_manager&class-id="?>" + treeNode.id,'_self');
							}
							else
							{
								window.open("<?=_U('link/index')."?tab=link_manager&class-id="?>" + treeNode.id + "&descendant=true",'_self');
							}
						} 
				
						$.fn.zTree.init($("#link_class_tree"), link_class_setting );
						// var treeObj = $.fn.zTree.getZTreeObj("link_class_tree");
				
						// treeObj.expandAll(true) ; 
					});
				 	</script>
					<h5 class="h5_2">链接分类</h5>
					<div class="ul_top">链接分类</div>
					<div class="ul_div" >
						<ul id="link_class_tree" class="ztree other1" style="margin-top:-1px;list-style:none;margin-left:20px;font-size:16px;"></ul>
					</div>
				</div>
				<?php endif;?>
			</div>
			
			<div style="clear:both"></div>
		</div>
	</div>
	<div class="copy  picpng">
		Copyright © 2014 巨人软件研发有限公司<div class="copyright"><a href="http://cms.jurensoft.cn" title="Powered by JurenSoft" target="_blank">Powered by JRcms</a></div>
	</div>
	
</body>
</html>